package com.umeox.moto.watch.fitness.base

import okhttp3.OkHttpClient
import java.util.concurrent.TimeUnit

/**
 * Created by Rambo 2021/12/13
 * Describe:
 */
object UnsafeOkHttpClient {
    fun getUnsafeOkHttpClient(): OkHttpClient? {
        return try {
            val params: HttpsHelp.SSLParams = HttpsHelp.getTlsSocketFactory()
            val builder = OkHttpClient.Builder()
            builder.sslSocketFactory(params.sSLSocketFactory, params.trustManager)
            builder.hostnameVerifier(params.hostnameVerifier)
            builder.connectTimeout(20, TimeUnit.SECONDS)
            builder.readTimeout(20, TimeUnit.SECONDS)
            builder.build()
        } catch (e: Exception) {
            throw RuntimeException(e)
        }
    }
}